package com.smart.fifteen.annotate.cacheable;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestSpring {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("com/smart/fifteen/annotate/applicationContext-annotate.xml");
        UserService userService = (UserService) ac.getBean("userServiceCacheAble");
        System.out.println("first find");
        userService.getUser("1");

        System.out.println("second find");
        userService.getUser("1");

        /*
            first find
            find user
            find user from DB
            second find //没有进find方法，直接从缓存中获取
         */

    }
}
